<template>
	<view class="bodybox">
		<!-- <view class="example-title">基础卡片</view> -->
		<uni-section title="我的项目" type="line"></uni-section>
		<view class="example-body">
			<view v-for="item in project" :key="item.proId" class="example-box">
				<uni-card :title="item.proName" :note="item.endtime" :extra="item.schedule" @click="clickCard(item)">
					<text class="content-box-text">项目资金:{{ item.fund }}￥</text>
				</uni-card>
			</view>
		</view>
	</view>
</template>
<script>
	import uniSection from '@/components/uni-section/uni-section.vue'
	import uniCard from '@/components/uni-card/uni-card.vue'
	export default {
		components: {
			uniSection,
			uniCard
		},
		data() {
			return {
				myCount:"",
				project:""
			}
		},
		onLoad() {
			try {
				this.myCount = uni.getStorageSync("myCount");
			} catch(e) {
				console.log("获取个人信息失败")
			}
			this.getProject();
		},
		methods:{
			clickCard:function(pro){
				let proId = pro.proId;
				console.log(proId)
				uni.navigateTo({
					url:'details/details?proId='+proId
				})
			},
			getProject:function(){
				uni.request({
					url:"http://"+global.address+":8081/project/selectByRoleId/0/0/"+this.myCount.userId,
					method:"GET",
					success: (res) => {
						console.log(JSON.stringify(res.data));
						this.project = res.data
					}
				})
			}
		}
	}
</script>
<style>
	/* 头条小程序组件内不能引入字体 */
	/* #ifdef MP-TOUTIAO */
	@font-face {
		font-family: uniicons;
		font-weight: normal;
		font-style: normal;
		src: url('~@/static/uni.ttf') format('truetype');
	}

	/* #endif */

	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #efeff4;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 28rpx;
		line-height: inherit;
	}

	page{
		background-color: #F1F1F1;
	}

	.example {
		padding: 0 30rpx 30rpx;
	}

	.example-info {
		padding: 30rpx;
		color: #3b4144;
		background: #ffffff;
	}

	.example-body {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
		padding: 0;
		font-size: 14rpx;
		background-color: #ffffff;
	}

	/* #endif */
	.example {
		padding: 0 30rpx;
	}

	.example-info {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		padding: 30rpx;
		color: #3b4144;
		background-color: #ffffff;
		font-size: 30rpx;
	}

	.example-info-text {
		font-size: 28rpx;
		line-height: 36rpx;
	}


	.example-body {
		flex-direction: column;
		padding: 30rpx;
		background-color: #ffffff;
	}

	.word-btn-white {
		font-size: 18px;
		color: #FFFFFF;
	}

	.word-btn {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		border-radius: 6px;
		height: 48px;
		margin: 15px;
		background-color: #007AFF;
	}

	.word-btn--hover {
		background-color: #4ca2ff;
	}


	.example-body {
		padding: 20rpx 0;
		padding-bottom: 0;

	}

	.example-box {
		/* margin-bottom: 30rpx;
 */
	}

	.image-box {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		height: 350rpx;
		overflow: hidden;
	}

	.image {
		/* #ifndef APP-NVUE */
		width: 100%;
		height: 100%;
		/* #endif */
		flex: 1;
	}

	.content-box {
		padding-top: 20rpx;
	}

	.content-box-text {
		font-size: 30rpx;
	}

	.footer-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		justify-content: space-between;
		flex-direction: row;

	}

	.footer-box__item {
		align-items: center;
		padding: 10rpx 0;
		font-size: 30rpx;
		color: #666;
	}
</style>